package team.ifgroup.tss.utils;

import com.csvreader.CsvReader;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by liangyue on 2017/11/26.
 */
public class Csv {
    public static List<String[]> read(String filePath){
        List<String[]> result = new ArrayList<String[]>();
        try {
            // 创建CSV读对象
            CsvReader csvReader = new CsvReader(filePath);

            // 读表头
            csvReader.readHeaders();

            while (csvReader.readRecord()){
                // 读一整行
                System.out.println(csvReader.getRawRecord());
                String[] strArr = csvReader.getRawRecord().split(",");
                result.add(strArr);
            }
            return result;

        } catch (IOException e) {
            e.printStackTrace();
        }
        return result;

    }

}
